package com.example.wacoffee_user.config;

import com.example.wacoffee_user.interceptor.TokenInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class WebConfig implements WebMvcConfigurer {
    @Autowired
    private TokenInterceptor tokenInterceptor;

    @Override
    public void addInterceptors(org.springframework.web.servlet.config.annotation.InterceptorRegistry registry) {
        registry.addInterceptor(tokenInterceptor).addPathPatterns("/**")
                .excludePathPatterns("/cart/condition")
                .excludePathPatterns("/me/login")
                .excludePathPatterns("/register")
                .excludePathPatterns("/")
                .excludePathPatterns("/cart")
                .excludePathPatterns("/getCode");
    }
}
